package Apresentation;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.bean.ViewScoped;

import Domain.Account;
import Domain.CreditCardDetail;
import Domain.Order;
import Domain.OrderDetail;
import Integration.Integration;
import Integration.IntegrationImpl;

@ManagedBean(value="myBean")
@SessionScoped
public class DetalheOrderBean {
	
	
	private Account usuario;
	private Order order;
	private CreditCardDetail cartao;
	private List<OrderDetail> detalhes;
	
	private Integration it;
	public DetalheOrderBean() {
		super();
		
		usuario = new Account();
		order = new Order();
		cartao = new CreditCardDetail();
		detalhes = new ArrayList<OrderDetail>();
		it = new IntegrationImpl();
	}
	
	
	
	public String exibirOrder(Order order){
		
		this.order = order;
		usuario = order.getAccount();
		cartao = order.getCredit_card();
		detalhes = it.listarItensOrder(order);
		
		return "detalheCompra.xhtml?faces-redirect=true";
		
	}
	
	
	
	
	
	public Account getUsuario() {
		return usuario;
	}
	public void setUsuario(Account usuario) {
		this.usuario = usuario;
	}
	public Order getOrder() {
		return order;
	}
	public void setOrder(Order order) {
		this.order = order;
	}
	public CreditCardDetail getCartao() {
		return cartao;
	}
	public void setCartao(CreditCardDetail cartao) {
		this.cartao = cartao;
	}
	public List<OrderDetail> getDetalhes() {
		return detalhes;
	}
	public void setDetalhes(List<OrderDetail> detalhe) {
		this.detalhes = detalhe;
	}
	
	
	
	
	
	
	

}
